package com.dobbinsoft.iotechn.core.util;


import com.dobbinsoft.iotechn.core.model.DeveloperSession;
import com.dobbinsoft.iotechn.core.model.UserSession;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: rize
 * Date: 2020/3/18
 * Time: 11:13
 */
public class SessionUtil {

    private static final ThreadLocal<DeveloperSession> developerThreadLocal = new ThreadLocal<>();

    private static final ThreadLocal<UserSession> userThreadLocal = new ThreadLocal<>();

    public static void setUser(UserSession user) {
        userThreadLocal.set(user);
    }

    public static UserSession getUser() {
        return userThreadLocal.get();
    }

    public static void setDeveloper(DeveloperSession developer) {
        developerThreadLocal.set(developer);
    }

    public static DeveloperSession getDeveloper() {
        return developerThreadLocal.get();
    }

}

